﻿//********************************************************************
// Author:      Cxq
// Create Date: 2012-08-25
// Description: 
//
// Version:     1.0.0.0
// Change History:
// Date		    Who		      Changes Made
//--------------------------------------------------------------------
// Please Insert the Modiy record here!
//--------------------------------------------------------------------
//********************************************************************



using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

using SZSE.Framework2.Common;
using SZSE.Application.LSD.Common;
using SZSE.Application.LSD.DataContract;

namespace SZSE.Application.LSD.DataAccess
{
	/// <summary>
	/// 这个类提供了对stockquotations ()表的数据库操作
	/// </summary>
	public static partial class stockquotationsManager
	{
		private static IDBAccess db=DatabaseFactory.CreateDatabase(AppConstants.BizDBInstanceName);

		static string insertSQL ="INSERT INTO [stockquotations] ([id],[outflowretail],[inflowretail],[outflowmain],[inflowmain],[changeratio],[turnoverrate],[modifytime],[createtime],[sellingprice5],[sellingvolume5],[sellingprice4],[sellingvolume4],[sellingprice3],[sellingvolume3],[sellingprice2],[sellingvolume2],[sellingprice1],[sellingvolume1],[buyingprice5],[buyingvolume5],[buyingprice4],[buyingvolume4],[buyingprice3],[buyingvolume3],[buyingprice2],[buyingvolume2],[buyingprice1],[buyingvolume1],[reserveprice],[competitiveprice],[tradingmoneyvolume],[tradingvolume],[todaylowestprice],[todayhighestprice],[todayclosingprice],[yesterdayclosingprice],[todayopeningprice],[tradeday],[seccode]) VALUES (@id,@outflowretail,@inflowretail,@outflowmain,@inflowmain,@changeratio,@turnoverrate,@modifytime,@createtime,@sellingprice5,@sellingvolume5,@sellingprice4,@sellingvolume4,@sellingprice3,@sellingvolume3,@sellingprice2,@sellingvolume2,@sellingprice1,@sellingvolume1,@buyingprice5,@buyingvolume5,@buyingprice4,@buyingvolume4,@buyingprice3,@buyingvolume3,@buyingprice2,@buyingvolume2,@buyingprice1,@buyingvolume1,@reserveprice,@competitiveprice,@tradingmoneyvolume,@tradingvolume,@todaylowestprice,@todayhighestprice,@todayclosingprice,@yesterdayclosingprice,@todayopeningprice,@tradeday,@seccode)";
	
		static string updateSQL ="Update [stockquotations] Set [id]=@id,[outflowretail]=@outflowretail,[inflowretail]=@inflowretail,[outflowmain]=@outflowmain,[inflowmain]=@inflowmain,[changeratio]=@changeratio,[turnoverrate]=@turnoverrate,[modifytime]=@modifytime,[createtime]=@createtime,[sellingprice5]=@sellingprice5,[sellingvolume5]=@sellingvolume5,[sellingprice4]=@sellingprice4,[sellingvolume4]=@sellingvolume4,[sellingprice3]=@sellingprice3,[sellingvolume3]=@sellingvolume3,[sellingprice2]=@sellingprice2,[sellingvolume2]=@sellingvolume2,[sellingprice1]=@sellingprice1,[sellingvolume1]=@sellingvolume1,[buyingprice5]=@buyingprice5,[buyingvolume5]=@buyingvolume5,[buyingprice4]=@buyingprice4,[buyingvolume4]=@buyingvolume4,[buyingprice3]=@buyingprice3,[buyingvolume3]=@buyingvolume3,[buyingprice2]=@buyingprice2,[buyingvolume2]=@buyingvolume2,[buyingprice1]=@buyingprice1,[buyingvolume1]=@buyingvolume1,[reserveprice]=@reserveprice,[competitiveprice]=@competitiveprice,[tradingmoneyvolume]=@tradingmoneyvolume,[tradingvolume]=@tradingvolume,[todaylowestprice]=@todaylowestprice,[todayhighestprice]=@todayhighestprice,[todayclosingprice]=@todayclosingprice,[yesterdayclosingprice]=@yesterdayclosingprice,[todayopeningprice]=@todayopeningprice,[tradeday]=@tradeday,[seccode]=@seccode Where 1=1";

		static string deleteSQL ="DELETE FROM  [stockquotations]  Where 1=1";	
		
		#region codesmith生成的代码
		/// <summary>
		/// 获取stockquotationsEntity实体 
		/// </summary>
		/// <param name="id">id</param>
		/// <returns>stockquotationsEntity</returns>
		public static stockquotationsEntity GetstockquotationsEntity(int id)
		{
			string strSQL = "select * from stockquotations where 1=1";			
			IDbDataParameter para_id = new SqlParameter("id", SqlDbType.__UNKNOWN__integer);
			para_id.Value = id;
			IDbDataParameter[] paras=new IDbDataParameter[]{para_id};
			
			
			stockquotationsEntity entity=new stockquotationsEntity();
			using(System.Data.IDataReader reader=db.ExecuteReader(CommandType.Text, strSQL,paras))
			{
				if(reader.Read()==false) return null;
				LoadFromReader(reader, entity);
				return entity;
			}
		}		
		  
		
		
       		
		/// <summary>
		/// 更新stockquotationsEntity
		/// </summary>
		/// <param name="entity">Entity</param>	
		public static void Updatestockquotations(stockquotationsEntity entity)
		{
			if(entity==null)
			{
				throw new DataAccessLayerException("参数[entity]为[null]！");
			}
			IDbDataParameter[] paras =GenerateParas(entity);		
			db.ExecuteNonQuery(CommandType.Text,updateSQL,paras);
		}
		
		
				
		
		/// <summary>
		///  删除一条记录
		/// </summary>
		/// <param name="id">id</param>		
		public static void Deletestockquotations(int id)
		{
			IDbDataParameter para_id = new SqlParameter("id", SqlDbType.__UNKNOWN__integer);
			para_id.Value = id;
			IDbDataParameter[] paras=new IDbDataParameter[]{para_id};
			db.ExecuteNonQuery(CommandType.Text,deleteSQL,paras);
		}

	
		
		/// <summary>
		/// 删除多条记录
		/// </summary>
		/// <param name="ids">ids</param>		
		public static void Deletestockquotations(List<int> ids)
		{
			string strSQL = "DELETE FROM  stockquotations  Where [id] in ({0}) ";
            string deleteIds = FormatHelper.ConvertListToSQLString<int>(ids);
            db.ExecuteNonQuery(string.Format(strSQL, deleteIds));
		}
		
		
	
		/// <summary>
		/// 根据分页条件获取stockquotations数据集
		/// </summary>
		/// <param name="conditions">条件</param>	
		/// <param name="sortExpression">排序表达式，为空则默认为:id</param>		
		/// <param name="pageIndex">开始页码：分页查询中的开始页码</param>
		/// <param name="pageSize">页宽：分页查询中的每页的记录数</param>
		/// <param name="recordCount">页宽：分页查询中的每页的记录数</param>		
		/// <returns>数据集(DataSet)：<br/>
        /// <table>
        /// <tr><td>字段名</td><td>字段类型</td><td>数据库类型</td><td>字段说明</td></tr>
        /// <tr><td>id</td><td>int</td><td>integer NotAllowDBNull</td><td>id</td></tr>
        /// <tr><td>outflowretail</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>outflowretail</td></tr>
        /// <tr><td>inflowretail</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>inflowretail</td></tr>
        /// <tr><td>outflowmain</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>outflowmain</td></tr>
        /// <tr><td>inflowmain</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>inflowmain</td></tr>
        /// <tr><td>changeratio</td><td>decimal</td><td>numeric(10, 8) AllowDBNull</td><td>changeratio</td></tr>
        /// <tr><td>turnoverrate</td><td>decimal</td><td>numeric(8, 6) AllowDBNull</td><td>turnoverrate</td></tr>
        /// <tr><td>modifytime</td><td>DateTime</td><td>date AllowDBNull</td><td>modifytime</td></tr>
        /// <tr><td>createtime</td><td>DateTime</td><td>date AllowDBNull</td><td>createtime</td></tr>
        /// <tr><td>sellingprice5</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice5</td></tr>
        /// <tr><td>sellingvolume5</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume5</td></tr>
        /// <tr><td>sellingprice4</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice4</td></tr>
        /// <tr><td>sellingvolume4</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume4</td></tr>
        /// <tr><td>sellingprice3</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice3</td></tr>
        /// <tr><td>sellingvolume3</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume3</td></tr>
        /// <tr><td>sellingprice2</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice2</td></tr>
        /// <tr><td>sellingvolume2</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume2</td></tr>
        /// <tr><td>sellingprice1</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice1</td></tr>
        /// <tr><td>sellingvolume1</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume1</td></tr>
        /// <tr><td>buyingprice5</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice5</td></tr>
        /// <tr><td>buyingvolume5</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume5</td></tr>
        /// <tr><td>buyingprice4</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice4</td></tr>
        /// <tr><td>buyingvolume4</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume4</td></tr>
        /// <tr><td>buyingprice3</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice3</td></tr>
        /// <tr><td>buyingvolume3</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume3</td></tr>
        /// <tr><td>buyingprice2</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice2</td></tr>
        /// <tr><td>buyingvolume2</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume2</td></tr>
        /// <tr><td>buyingprice1</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice1</td></tr>
        /// <tr><td>buyingvolume1</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume1</td></tr>
        /// <tr><td>reserveprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>reserveprice</td></tr>
        /// <tr><td>competitiveprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>competitiveprice</td></tr>
        /// <tr><td>tradingmoneyvolume</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>tradingmoneyvolume</td></tr>
        /// <tr><td>tradingvolume</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>tradingvolume</td></tr>
        /// <tr><td>todaylowestprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todaylowestprice</td></tr>
        /// <tr><td>todayhighestprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todayhighestprice</td></tr>
        /// <tr><td>todayclosingprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todayclosingprice</td></tr>
        /// <tr><td>yesterdayclosingprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>yesterdayclosingprice</td></tr>
        /// <tr><td>todayopeningprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todayopeningprice</td></tr>
        /// <tr><td>tradeday</td><td>DateTime</td><td>date AllowDBNull</td><td>tradeday</td></tr>
        /// <tr><td>seccode</td><td>string</td><td>character(6) AllowDBNull</td><td>seccode</td></tr>
        /// </table></returns>
		public static List<stockquotationsEntity> GetstockquotationssByCond(string conditions,string sortExpression,int pageIndex,int pageSize,out int recordCount)
		{			
			if(string.IsNullOrEmpty(sortExpression) || string.IsNullOrEmpty(sortExpression.Trim()))
			{
				sortExpression = "id";
			}

			//Prepare the query conditions
			ElbDatabase.PrepareSqlConditions(ref conditions);

			//view or table's Name
			string viewName="stockquotations";
			
			recordCount=-1;
			//Get the recordCount only when pageIndex==0 
			if(pageIndex==0)
			{
				//get the record count of this query
				string countSQL = "Select count(1) from {0} where 1=1 {1}";
				recordCount = (int) db.ExecuteScalar(string.Format(countSQL,viewName, conditions));
			}
			
			
			
			//the fields of this qurey want to get
			string fields ="*";			
			
			//get a page record 
			Int64 startNumber=pageIndex*pageSize+1;
			Int64 endNumber = startNumber + pageSize-1;
			string queryString = @"WITH [temptablefor{0}] AS
								   (  SELECT *,ROW_NUMBER() OVER (order by {1} ) as RowNumber 
									  FROM [{0}] Where 1=1 {2}
								   ) 
								   SELECT {3} FROM [temptablefor{0}] Where RowNumber between {4} and {5}";
			
			object[] paras =new object[] {viewName,sortExpression,conditions, fields, startNumber.ToString(),endNumber.ToString()};			
						
			List<stockquotationsEntity> list=new List<stockquotationsEntity>();
			
			stockquotationsEntity entity;
			using(System.Data.IDataReader reader=db.ExecuteReader(string.Format(queryString,paras)))
			{
				 while (reader.Read()==true)
				{
					entity=new stockquotationsEntity();
					LoadFromReader(reader, entity);
					list.Add(entity);
				}				
			}
			return list;
			
		}
				
		
		/// <summary>
		/// 根据条件获取stockquotations数据集
		/// </summary>
		/// <param name="conditions">条件</param>	
		/// <param name="sortExpression">排序表达式，为空则默认为:id</param>		
		/// <returns>数据集(DataSet)：<br/>
        /// <table>
        /// <tr><td>字段名</td><td>字段类型</td><td>数据库类型</td><td>字段说明</td></tr>
        /// <tr><td>id</td><td>int</td><td>integer NotAllowDBNull</td><td>id</td></tr>
        /// <tr><td>outflowretail</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>outflowretail</td></tr>
        /// <tr><td>inflowretail</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>inflowretail</td></tr>
        /// <tr><td>outflowmain</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>outflowmain</td></tr>
        /// <tr><td>inflowmain</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>inflowmain</td></tr>
        /// <tr><td>changeratio</td><td>decimal</td><td>numeric(10, 8) AllowDBNull</td><td>changeratio</td></tr>
        /// <tr><td>turnoverrate</td><td>decimal</td><td>numeric(8, 6) AllowDBNull</td><td>turnoverrate</td></tr>
        /// <tr><td>modifytime</td><td>DateTime</td><td>date AllowDBNull</td><td>modifytime</td></tr>
        /// <tr><td>createtime</td><td>DateTime</td><td>date AllowDBNull</td><td>createtime</td></tr>
        /// <tr><td>sellingprice5</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice5</td></tr>
        /// <tr><td>sellingvolume5</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume5</td></tr>
        /// <tr><td>sellingprice4</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice4</td></tr>
        /// <tr><td>sellingvolume4</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume4</td></tr>
        /// <tr><td>sellingprice3</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice3</td></tr>
        /// <tr><td>sellingvolume3</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume3</td></tr>
        /// <tr><td>sellingprice2</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice2</td></tr>
        /// <tr><td>sellingvolume2</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume2</td></tr>
        /// <tr><td>sellingprice1</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>sellingprice1</td></tr>
        /// <tr><td>sellingvolume1</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>sellingvolume1</td></tr>
        /// <tr><td>buyingprice5</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice5</td></tr>
        /// <tr><td>buyingvolume5</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume5</td></tr>
        /// <tr><td>buyingprice4</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice4</td></tr>
        /// <tr><td>buyingvolume4</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume4</td></tr>
        /// <tr><td>buyingprice3</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice3</td></tr>
        /// <tr><td>buyingvolume3</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume3</td></tr>
        /// <tr><td>buyingprice2</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice2</td></tr>
        /// <tr><td>buyingvolume2</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume2</td></tr>
        /// <tr><td>buyingprice1</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>buyingprice1</td></tr>
        /// <tr><td>buyingvolume1</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>buyingvolume1</td></tr>
        /// <tr><td>reserveprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>reserveprice</td></tr>
        /// <tr><td>competitiveprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>competitiveprice</td></tr>
        /// <tr><td>tradingmoneyvolume</td><td>decimal</td><td>numeric(20, 3) AllowDBNull</td><td>tradingmoneyvolume</td></tr>
        /// <tr><td>tradingvolume</td><td>decimal</td><td>numeric(18, 0) AllowDBNull</td><td>tradingvolume</td></tr>
        /// <tr><td>todaylowestprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todaylowestprice</td></tr>
        /// <tr><td>todayhighestprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todayhighestprice</td></tr>
        /// <tr><td>todayclosingprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todayclosingprice</td></tr>
        /// <tr><td>yesterdayclosingprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>yesterdayclosingprice</td></tr>
        /// <tr><td>todayopeningprice</td><td>decimal</td><td>numeric(9, 3) AllowDBNull</td><td>todayopeningprice</td></tr>
        /// <tr><td>tradeday</td><td>DateTime</td><td>date AllowDBNull</td><td>tradeday</td></tr>
        /// <tr><td>seccode</td><td>string</td><td>character(6) AllowDBNull</td><td>seccode</td></tr>
        /// </table></returns>
		public static DataSet GetstockquotationssByCond(string conditions,string sortExpression)
		{			
			if(sortExpression==null || sortExpression.Trim()=="")
			{
				sortExpression = "id";
			}

			//Prepare the query conditions
			ElbDatabase.PrepareSqlConditions(ref conditions);

			//view or table's Name
			string viewName="stockquotations";

			//the fields of this qurey want to get
			string fields ="*";			
			
			//get a page record 
			string queryString = "SELECT {0} FROM {1} WHERE 1=1 {2} ORDER BY {3}";
								
			object[] paras =new object[] {fields,viewName,conditions,sortExpression};			
			return db.ExecuteDataSet(string.Format(queryString,paras));			
		}
		#region private method
		/// <summary>
        /// 获取stockquotationsEntity实体数据更新参数
        /// </summary>
        /// <param name="entity">CompanyEntity</param>
        /// <returns></returns>
        private static IDbDataParameter[] GenerateParas(stockquotationsEntity entity)
        { 
			IDbDataParameter para_id = new SqlParameter("id", SqlDbType.__UNKNOWN__integer);
			para_id.Value = entity.id;
			
			IDbDataParameter para_outflowretail = new SqlParameter("outflowretail", SqlDbType.Decimal);
			para_outflowretail.Value = entity.outflowretail;
			
			IDbDataParameter para_inflowretail = new SqlParameter("inflowretail", SqlDbType.Decimal);
			para_inflowretail.Value = entity.inflowretail;
			
			IDbDataParameter para_outflowmain = new SqlParameter("outflowmain", SqlDbType.Decimal);
			para_outflowmain.Value = entity.outflowmain;
			
			IDbDataParameter para_inflowmain = new SqlParameter("inflowmain", SqlDbType.Decimal);
			para_inflowmain.Value = entity.inflowmain;
			
			IDbDataParameter para_changeratio = new SqlParameter("changeratio", SqlDbType.Decimal);
			para_changeratio.Value = entity.changeratio;
			
			IDbDataParameter para_turnoverrate = new SqlParameter("turnoverrate", SqlDbType.Decimal);
			para_turnoverrate.Value = entity.turnoverrate;
			
			IDbDataParameter para_modifytime = new SqlParameter("modifytime", SqlDbType.__UNKNOWN__date);
			para_modifytime.Value = entity.modifytime;
			
			IDbDataParameter para_createtime = new SqlParameter("createtime", SqlDbType.__UNKNOWN__date);
			para_createtime.Value = entity.createtime;
			
			IDbDataParameter para_sellingprice5 = new SqlParameter("sellingprice5", SqlDbType.Decimal);
			para_sellingprice5.Value = entity.sellingprice5;
			
			IDbDataParameter para_sellingvolume5 = new SqlParameter("sellingvolume5", SqlDbType.Decimal);
			para_sellingvolume5.Value = entity.sellingvolume5;
			
			IDbDataParameter para_sellingprice4 = new SqlParameter("sellingprice4", SqlDbType.Decimal);
			para_sellingprice4.Value = entity.sellingprice4;
			
			IDbDataParameter para_sellingvolume4 = new SqlParameter("sellingvolume4", SqlDbType.Decimal);
			para_sellingvolume4.Value = entity.sellingvolume4;
			
			IDbDataParameter para_sellingprice3 = new SqlParameter("sellingprice3", SqlDbType.Decimal);
			para_sellingprice3.Value = entity.sellingprice3;
			
			IDbDataParameter para_sellingvolume3 = new SqlParameter("sellingvolume3", SqlDbType.Decimal);
			para_sellingvolume3.Value = entity.sellingvolume3;
			
			IDbDataParameter para_sellingprice2 = new SqlParameter("sellingprice2", SqlDbType.Decimal);
			para_sellingprice2.Value = entity.sellingprice2;
			
			IDbDataParameter para_sellingvolume2 = new SqlParameter("sellingvolume2", SqlDbType.Decimal);
			para_sellingvolume2.Value = entity.sellingvolume2;
			
			IDbDataParameter para_sellingprice1 = new SqlParameter("sellingprice1", SqlDbType.Decimal);
			para_sellingprice1.Value = entity.sellingprice1;
			
			IDbDataParameter para_sellingvolume1 = new SqlParameter("sellingvolume1", SqlDbType.Decimal);
			para_sellingvolume1.Value = entity.sellingvolume1;
			
			IDbDataParameter para_buyingprice5 = new SqlParameter("buyingprice5", SqlDbType.Decimal);
			para_buyingprice5.Value = entity.buyingprice5;
			
			IDbDataParameter para_buyingvolume5 = new SqlParameter("buyingvolume5", SqlDbType.Decimal);
			para_buyingvolume5.Value = entity.buyingvolume5;
			
			IDbDataParameter para_buyingprice4 = new SqlParameter("buyingprice4", SqlDbType.Decimal);
			para_buyingprice4.Value = entity.buyingprice4;
			
			IDbDataParameter para_buyingvolume4 = new SqlParameter("buyingvolume4", SqlDbType.Decimal);
			para_buyingvolume4.Value = entity.buyingvolume4;
			
			IDbDataParameter para_buyingprice3 = new SqlParameter("buyingprice3", SqlDbType.Decimal);
			para_buyingprice3.Value = entity.buyingprice3;
			
			IDbDataParameter para_buyingvolume3 = new SqlParameter("buyingvolume3", SqlDbType.Decimal);
			para_buyingvolume3.Value = entity.buyingvolume3;
			
			IDbDataParameter para_buyingprice2 = new SqlParameter("buyingprice2", SqlDbType.Decimal);
			para_buyingprice2.Value = entity.buyingprice2;
			
			IDbDataParameter para_buyingvolume2 = new SqlParameter("buyingvolume2", SqlDbType.Decimal);
			para_buyingvolume2.Value = entity.buyingvolume2;
			
			IDbDataParameter para_buyingprice1 = new SqlParameter("buyingprice1", SqlDbType.Decimal);
			para_buyingprice1.Value = entity.buyingprice1;
			
			IDbDataParameter para_buyingvolume1 = new SqlParameter("buyingvolume1", SqlDbType.Decimal);
			para_buyingvolume1.Value = entity.buyingvolume1;
			
			IDbDataParameter para_reserveprice = new SqlParameter("reserveprice", SqlDbType.Decimal);
			para_reserveprice.Value = entity.reserveprice;
			
			IDbDataParameter para_competitiveprice = new SqlParameter("competitiveprice", SqlDbType.Decimal);
			para_competitiveprice.Value = entity.competitiveprice;
			
			IDbDataParameter para_tradingmoneyvolume = new SqlParameter("tradingmoneyvolume", SqlDbType.Decimal);
			para_tradingmoneyvolume.Value = entity.tradingmoneyvolume;
			
			IDbDataParameter para_tradingvolume = new SqlParameter("tradingvolume", SqlDbType.Decimal);
			para_tradingvolume.Value = entity.tradingvolume;
			
			IDbDataParameter para_todaylowestprice = new SqlParameter("todaylowestprice", SqlDbType.Decimal);
			para_todaylowestprice.Value = entity.todaylowestprice;
			
			IDbDataParameter para_todayhighestprice = new SqlParameter("todayhighestprice", SqlDbType.Decimal);
			para_todayhighestprice.Value = entity.todayhighestprice;
			
			IDbDataParameter para_todayclosingprice = new SqlParameter("todayclosingprice", SqlDbType.Decimal);
			para_todayclosingprice.Value = entity.todayclosingprice;
			
			IDbDataParameter para_yesterdayclosingprice = new SqlParameter("yesterdayclosingprice", SqlDbType.Decimal);
			para_yesterdayclosingprice.Value = entity.yesterdayclosingprice;
			
			IDbDataParameter para_todayopeningprice = new SqlParameter("todayopeningprice", SqlDbType.Decimal);
			para_todayopeningprice.Value = entity.todayopeningprice;
			
			IDbDataParameter para_tradeday = new SqlParameter("tradeday", SqlDbType.__UNKNOWN__date);
			para_tradeday.Value = entity.tradeday;
			
			IDbDataParameter para_seccode = new SqlParameter("seccode", SqlDbType.__UNKNOWN__character);
			para_seccode.Value = entity.seccode;
			
			return new IDbDataParameter[]{para_id,para_outflowretail,para_inflowretail,para_outflowmain,para_inflowmain,para_changeratio,para_turnoverrate,para_modifytime,para_createtime,para_sellingprice5,para_sellingvolume5,para_sellingprice4,para_sellingvolume4,para_sellingprice3,para_sellingvolume3,para_sellingprice2,para_sellingvolume2,para_sellingprice1,para_sellingvolume1,para_buyingprice5,para_buyingvolume5,para_buyingprice4,para_buyingvolume4,para_buyingprice3,para_buyingvolume3,para_buyingprice2,para_buyingvolume2,para_buyingprice1,para_buyingvolume1,para_reserveprice,para_competitiveprice,para_tradingmoneyvolume,para_tradingvolume,para_todaylowestprice,para_todayhighestprice,para_todayclosingprice,para_yesterdayclosingprice,para_todayopeningprice,para_tradeday,para_seccode};	
        }
		
		/// <summary>
		/// 绑定数据到业务实体
		/// </summary>
		/// <param name="reader">DataReader</param>
		/// <param name="entity">业务实体</param>
		private static void LoadFromReader(IDataReader reader,stockquotationsEntity entity)
		{			
			if (reader != null && !reader.IsClosed)
			{
				//entity.Id = reader.GetInt32(0);
                if(!Convert.IsDBNull(reader["id"]))entity.id = (int)reader["id"];
                if(!Convert.IsDBNull(reader["outflowretail"]))entity.outflowretail = (decimal)reader["outflowretail"];
                if(!Convert.IsDBNull(reader["inflowretail"]))entity.inflowretail = (decimal)reader["inflowretail"];
                if(!Convert.IsDBNull(reader["outflowmain"]))entity.outflowmain = (decimal)reader["outflowmain"];
                if(!Convert.IsDBNull(reader["inflowmain"]))entity.inflowmain = (decimal)reader["inflowmain"];
                if(!Convert.IsDBNull(reader["changeratio"]))entity.changeratio = (decimal)reader["changeratio"];
                if(!Convert.IsDBNull(reader["turnoverrate"]))entity.turnoverrate = (decimal)reader["turnoverrate"];
                if(!Convert.IsDBNull(reader["modifytime"]))entity.modifytime = (DateTime)reader["modifytime"];
                if(!Convert.IsDBNull(reader["createtime"]))entity.createtime = (DateTime)reader["createtime"];
                if(!Convert.IsDBNull(reader["sellingprice5"]))entity.sellingprice5 = (decimal)reader["sellingprice5"];
                if(!Convert.IsDBNull(reader["sellingvolume5"]))entity.sellingvolume5 = (decimal)reader["sellingvolume5"];
                if(!Convert.IsDBNull(reader["sellingprice4"]))entity.sellingprice4 = (decimal)reader["sellingprice4"];
                if(!Convert.IsDBNull(reader["sellingvolume4"]))entity.sellingvolume4 = (decimal)reader["sellingvolume4"];
                if(!Convert.IsDBNull(reader["sellingprice3"]))entity.sellingprice3 = (decimal)reader["sellingprice3"];
                if(!Convert.IsDBNull(reader["sellingvolume3"]))entity.sellingvolume3 = (decimal)reader["sellingvolume3"];
                if(!Convert.IsDBNull(reader["sellingprice2"]))entity.sellingprice2 = (decimal)reader["sellingprice2"];
                if(!Convert.IsDBNull(reader["sellingvolume2"]))entity.sellingvolume2 = (decimal)reader["sellingvolume2"];
                if(!Convert.IsDBNull(reader["sellingprice1"]))entity.sellingprice1 = (decimal)reader["sellingprice1"];
                if(!Convert.IsDBNull(reader["sellingvolume1"]))entity.sellingvolume1 = (decimal)reader["sellingvolume1"];
                if(!Convert.IsDBNull(reader["buyingprice5"]))entity.buyingprice5 = (decimal)reader["buyingprice5"];
                if(!Convert.IsDBNull(reader["buyingvolume5"]))entity.buyingvolume5 = (decimal)reader["buyingvolume5"];
                if(!Convert.IsDBNull(reader["buyingprice4"]))entity.buyingprice4 = (decimal)reader["buyingprice4"];
                if(!Convert.IsDBNull(reader["buyingvolume4"]))entity.buyingvolume4 = (decimal)reader["buyingvolume4"];
                if(!Convert.IsDBNull(reader["buyingprice3"]))entity.buyingprice3 = (decimal)reader["buyingprice3"];
                if(!Convert.IsDBNull(reader["buyingvolume3"]))entity.buyingvolume3 = (decimal)reader["buyingvolume3"];
                if(!Convert.IsDBNull(reader["buyingprice2"]))entity.buyingprice2 = (decimal)reader["buyingprice2"];
                if(!Convert.IsDBNull(reader["buyingvolume2"]))entity.buyingvolume2 = (decimal)reader["buyingvolume2"];
                if(!Convert.IsDBNull(reader["buyingprice1"]))entity.buyingprice1 = (decimal)reader["buyingprice1"];
                if(!Convert.IsDBNull(reader["buyingvolume1"]))entity.buyingvolume1 = (decimal)reader["buyingvolume1"];
                if(!Convert.IsDBNull(reader["reserveprice"]))entity.reserveprice = (decimal)reader["reserveprice"];
                if(!Convert.IsDBNull(reader["competitiveprice"]))entity.competitiveprice = (decimal)reader["competitiveprice"];
                if(!Convert.IsDBNull(reader["tradingmoneyvolume"]))entity.tradingmoneyvolume = (decimal)reader["tradingmoneyvolume"];
                if(!Convert.IsDBNull(reader["tradingvolume"]))entity.tradingvolume = (decimal)reader["tradingvolume"];
                if(!Convert.IsDBNull(reader["todaylowestprice"]))entity.todaylowestprice = (decimal)reader["todaylowestprice"];
                if(!Convert.IsDBNull(reader["todayhighestprice"]))entity.todayhighestprice = (decimal)reader["todayhighestprice"];
                if(!Convert.IsDBNull(reader["todayclosingprice"]))entity.todayclosingprice = (decimal)reader["todayclosingprice"];
                if(!Convert.IsDBNull(reader["yesterdayclosingprice"]))entity.yesterdayclosingprice = (decimal)reader["yesterdayclosingprice"];
                if(!Convert.IsDBNull(reader["todayopeningprice"]))entity.todayopeningprice = (decimal)reader["todayopeningprice"];
                if(!Convert.IsDBNull(reader["tradeday"]))entity.tradeday = (DateTime)reader["tradeday"];
                if(!Convert.IsDBNull(reader["seccode"]))entity.seccode = reader["seccode"].ToString();
			}
			
		}
		#endregion	
		
		#endregion
		
		#region 手工增加的代码
       
        #endregion
		

		
	}
}

